package com.self.common.exception;

/**
 * @version v1.0
 * @ClassName: BusinessException
 * @Description:
 * @Author: Mac
 * @Date: 2022/6/2 23:04
 */
public class BusinessException extends RuntimeException{

    private int code;
    private String msg;

    public BusinessException(String message, int code) {
        super(message);
        this.code = code;
        this.msg = message;
    }
    public BusinessException(RestError error) {
        super(error.getMsg());
        this.code = error.getCode();
        this.msg = error.getMsg();
    }

    public BusinessException(String msg) {
        super(msg);
        this.code = RestError.SERVICE_EXCE.getCode();
        this.msg = msg;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
